import React from 'react'

import routes from '../../routes/config';
import './SimpleSilder1.less';
import {Menu, Icon} from "antd";


export default class SimpleSilder1 extends React.Component {

  state = {
    current: this.props.defaultSelectKey || '/app/business/agencyhasdone',
    visiable:true,//撑开状态 true
  }

  handleItemClick = (e) => {
    console.log('click ', e);
    this.setState({
      current: e.key,
    });
  }


  renderItem = ({item}) => {
    return (
      <Menu.Item
        className={"ant-menu-item"}
        key={item.key}>
        <span className={'item-font-color-3 '}>{item.title}</span>
      </Menu.Item>
    )
  }

  render() {

    const visiable  = this.state.visiable;
    return (
      <div className={"simple-silder1"}>
        {
          <div className={`simple-silder1-container${visiable?'':"1"}`}>
            <div className={'silder1-title item-select'}>
              <span>业务系统</span>
            </div>

            <Menu
              onClick={this.handleItemClick}
              selectedKeys={[this.state.current]}
              defaultOpenKeys={['2']}
              mode="inline"
            >
              {routes.menus[1].subs.map((item) => {
                return (
                  this.renderItem({item})
                )
              })
              }
            </Menu>

          </div>
        }
        <div className={"simple-silder1-right-line"}>
          {/*<div*/}
            {/*onClick={()=>this.setState({*/}
              {/*visiable:!this.state.visiable*/}
            {/*})}*/}
            {/*className={"simple-silder1-right-line-warpper"}*/}
          {/*>*/}
            {/*<Icon type="menu-fold" theme="outlined"/>*/}
          {/*</div>*/}

        </div>
      </div>
    )
  }


}
